import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import ElementPlus from "element-plus";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import "element-plus/dist/index.css";
import request from "./utils/request";
import api from "./api";

console.log("环境变量", import.meta.env);

const app = createApp(App);

app.config.globalProperties.$request = request;
app.config.globalProperties.$api = api;

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// highlight 的样式，依赖包，组件
import "highlight.js/styles/atom-one-light.css";
import "highlight.js/lib/common";
import hljsVuePlugin from "@highlightjs/vue-plugin";
import java from "highlight.js/lib/languages/java";
import less from "highlight.js/lib/languages/less";
import hljs from "highlight.js/lib/core";

hljs.registerLanguage("java", java);
hljs.registerLanguage("less", less);

//注册组件
app
  .use(router)
  .use(ElementPlus, { size: "small" })
  .use(hljsVuePlugin)
  .mount("#app");
